﻿using System.Collections.Generic;
using Inovout.Business;
using Inovout.Gui.Wpf.Controls;

namespace Inovout.Gui.Wpf
{
    public static class ToolBarDescriptor
    {

        public static List<object> Build(IFunction[] functions)
        {
            List<object> toolBars = new List<object>();
            foreach (IFunction function in functions)
            {
                toolBars.Add(new XButtion
                {
                    Name = function.Name,
                    Command =null// new ViewModelCommand(function as Function)
                });
            //    ToolBar toolBar = CreateToolBar(function);
            //    toolBar.ItemsSource = CreateToolBars(function);
            //    toolBars.Add(toolBar);
            }
            return toolBars;
        }
        //private static ToolBar CreateToolBar(FunctionGroup functionGroup)
        //{
        //    return new ToolBar { Name = functionGroup.Name, Header = functionGroup.Name };

        //}
        //private static List<ToolBar> CreateToolBars(FunctionGroup functionGroup)
        //{
        //    List<ToolBar> toolBars = new List<ToolBar>();
        //    foreach (IFunction function in functionGroup.Functions)
        //    {
        //        ToolBar toolBar = null;
        //        if (function is FunctionGroup)
        //        {
        //            toolBar = CreateToolBar(function as FunctionGroup);
        //            toolBar.ItemsSource = CreateToolBars(function as FunctionGroup);
        //        }
        //        else
        //        {
        //            toolBar = new ToolBar
        //            {
        //                Name = function.Name,
        //                Header = function.Name,
        //              //  Command = new WorkItemCommand(function as Function)
        //            };

        //        }
        //        toolBars.Add(toolBar);
        //    }
        //    return toolBars;
        //}

   }
}
